using MicroMsg.UI.UserContrl;
using System;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Text;
namespace MicroMsg.Storage
{
	[Table]
	public class MassMsg : StorageItem, IListDataItem
	{
		[Column(IsPrimaryKey = true, IsDbGenerated = true)]
		public int nMsgLocalID;
		[Column]
		public int nStatus;
		[Column]
		public uint nMsgType;
		[Column]
		public string strUserNameList;
		[Column]
		public uint nUserCount;
		[Column]
		public long nTime;
		[Column]
		public string strFileName;
		[Column]
		public uint nDataTotalLength;
		[Column]
		public string strThumbFileName;
		[Column]
		public uint nThumbTotalLength;
		[Column]
		public string strClientMsgId;
		[Column]
		public bool bIsSendAgain;
		[Column]
		public byte[] bytesXmlData;
		[Column(CanBeNull = true)]
		public int? _pIsNeedScale;
		[Column(IsVersion = true)]
		private Binary _version;
		[Column(CanBeNull = true)]
		public int? pnMediaTime;
		[Column(CanBeNull = true, DbType = "Image")]
		public byte[] bytesContent;
		public bool isNeedScale
		{
			get
			{
				return !this._pIsNeedScale.get_HasValue() || this._pIsNeedScale.get_Value() != 0;
			}
			set
			{
				if (!this._pIsNeedScale.get_HasValue())
				{
					this._pIsNeedScale = default(int?);
				}
				this._pIsNeedScale = new int?(value ? 1 : 0);
			}
		}
		public int nMediaTime
		{
			get
			{
				if (this.pnMediaTime.get_HasValue())
				{
					return this.pnMediaTime.get_Value();
				}
				return 0;
			}
			set
			{
				if (this.pnMediaTime.get_HasValue() && this.pnMediaTime.get_Value() == value)
				{
					return;
				}
				this.pnMediaTime = new int?(value);
			}
		}
		public string strContent
		{
			get
			{
				if (this.bytesContent != null)
				{
					return Encoding.get_UTF8().GetString(this.bytesContent, 0, this.bytesContent.Length);
				}
				return null;
			}
			set
			{
				if (value == null)
				{
					this.bytesContent = null;
					return;
				}
				this.bytesContent = Encoding.get_UTF8().GetBytes(value);
			}
		}
		public void FillData(object item)
		{
			MassMsg massMsg = item as MassMsg;
			if (massMsg == null)
			{
				return;
			}
			massMsg.nMsgLocalID = this.nMsgLocalID;
			massMsg.nMsgType = this.nMsgType;
			massMsg.nStatus = this.nStatus;
			massMsg.strUserNameList = this.strUserNameList;
			massMsg.nUserCount = this.nUserCount;
			massMsg.nTime = this.nTime;
			massMsg.strFileName = this.strFileName;
			massMsg.nDataTotalLength = this.nDataTotalLength;
			massMsg.strThumbFileName = this.strThumbFileName;
			massMsg.nThumbTotalLength = this.nThumbTotalLength;
			massMsg.strClientMsgId = this.strClientMsgId;
			massMsg.bIsSendAgain = this.bIsSendAgain;
			massMsg.bytesXmlData = this.bytesXmlData;
			massMsg.nMediaTime = this.nMediaTime;
			massMsg.isNeedScale = this.isNeedScale;
		}
	}
}
